<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

//Route::post('admin/login', 'admin/login/index')
//    ->header('Access-Control-Allow-Origin','http://localhost:8080')
//    ->header('Access-Control-Allow-Credentials', 'true')
//    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
//    ->allowCrossDomain();;//登录接口
////总后台路由
//Route::group('admin', function () {
//    Route::get('/basic', 'admin/sysset/basic');//获取后台配置
//    Route::put('/basic/edit', 'admin/sysset/basic');//获取后台配置
//    Route::get('/index', 'admin/index/tongji');//首页
//    Route::get('/merch', 'admin/merch/index');//商户列表
//    Route::post('/upfile', 'commons/upfile/index');//上传图片
//    Route::put('/merch/edit', 'admin/merch/edit');//编辑商户信息
//    Route::post('/merch/add', 'admin/merch/add');//添加商户信息
//    Route::get('/video', 'admin/video/index');//视频列表
//    Route::get('/sale', 'admin/sale/index');//活动列表
//    Route::put('/sale/edit', 'admin/sale/edit');//编辑活动
//    Route::get('/sale_show', 'admin/sale/edit');//活动详情
//    Route::post('/sale/add', 'admin/sale/add');//添加活动
//    Route::get('/verifyer', 'admin/sale/verifyer');//核销员列表
//    Route::post('/verifyer/add', 'admin/sale/addverifyer');//添加核销员
//    Route::get('/verifyerqr', 'admin/sale/verifyerqr');//扫码绑定核销员
//    Route::get('/tuiguangqr', 'admin/sale/tuiguangqr');//推广码
//    Route::get('/cards', 'admin/sale/cards');//领券记录
//    Route::post('/hexiao', 'admin/sale/hexiao');//核销
//    Route::get('/sale_users', 'admin/sale/users');//参与用户列表
//    Route::get('/videodata', 'admin/sale/videodata');//参与用户列的视频数据
//    Route::get('/videototal', 'admin/sale/datas');//活动数据
//    Route::post('/sale_endsale', 'admin/sale/endsale');//结束活动
//    Route::post('/videogetdata', 'admin/video/getdata');//更新视频统计数据
//})->middleware('Admin')
//    ->header('Access-Control-Allow-Origin','http://localhost:8080')
//    ->header('Access-Control-Allow-Credentials', 'true')
//    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
//    ->allowCrossDomain();
Route::post('merchant/login', 'index/login/index')
    ->header('Access-Control-Allow-Origin','*')
    ->header('Access-Control-Allow-Credentials', 'true')
    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
    ->allowCrossDomain();;//登录接口
//商户后台
Route::group('merchant', function () {
    Route::get('/tongji', 'index/merchadmin/tongji');//首页
    Route::get('/userinfo', 'index/merchadmin/userinfo');//商户个人信息
    Route::put('/userinfo', 'index/merchadmin/userinfo');//编辑商户个人信息
    Route::post('/upload_file', 'index/upload/create');//上传图片/视频/音频
    Route::get('/video', 'index/video/index');//视频列表
    Route::get('/sale', 'index/sale/index');//活动列表
    Route::put('/sale/edit', 'index/sale/edit');//编辑活动
    Route::get('/sale_show', 'index/sale/edit');//活动详情
    Route::post('/sale/add', 'index/sale/add');//添加活动
    Route::post('/sale_create', 'index/sale/create');//添加活动
    Route::put('/sale_update', 'index/sale/update');//编辑活动
    Route::post('/material/create', 'index/material/create');//添加素材
    Route::post('/createvideo/create', 'index/createvideo/create');//生成视频
    Route::delete('/material/delete', 'index/material/delete');//删除素材
    Route::get('/activityvideo', 'index/activityvideo/index');//活动视频列表
    Route::delete('/activityvideo', 'index/activityvideo/delete');//删除活动视频
    Route::get('/verifyer', 'index/sale/verifyer');//核销员列表
    Route::get('/verifyer_list', 'index/verifyer/index');//核销员列表
    Route::post('/verifyer/add', 'index/sale/addverifyer');//添加核销员
    Route::post('/verifyer_create', 'index/verifyer/create');//添加核销员
    Route::delete('/verifyer_delete', 'index/verifyer/delete');//删除核销员
    Route::get('/verifyerqr', 'index/sale/verifyerqr');//扫码绑定核销员
    Route::get('/tuiguangqr', 'index/sale/tuiguangqr');//推广码
    Route::get('/cards', 'index/sale/cards');//领券记录
    Route::get('/sale_cards', 'index/crads/index');//领券记录
    Route::post('/sale_writes', 'index/crads/writes');//核销卡券
    Route::post('/hexiao', 'index/sale/hexiao');//核销
    Route::get('/sale_users', 'index/sale/users');//参与用户列表
    Route::get('/sale_users_list', 'index/saleUser/index');//参与用户列表
    Route::get('/videodata', 'index/sale/videodata');//参与用户列的视频数据
    Route::get('/sale_user_video', 'index/saleMemberVideo/index');//参与用户列的视频数据
    Route::get('/sale_num_video', 'index/saleVideo/videoDataNum');//活动视频数据
    Route::get('/videototal', 'index/sale/datas');//活动数据
    Route::post('/sale_endsale', 'index/sale/endsale');//结束活动
    Route::post('/sale_closure', 'index/sale/closure');//结束活动
    Route::post('/videogetdata', 'index/videom/getdata');//更新视频统计数据
    Route::post('/sync_video_all', 'index/videom/syncVideoAll');//更新视频统计数据
})->middleware('Merch')
    ->header('Access-Control-Allow-Origin','*')
    ->header('Access-Control-Allow-Credentials', 'true')
    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
    ->allowCrossDomain();

//web客户端
Route::post('user/login', 'web/login/index')
    ->header('Access-Control-Allow-Origin','*')
    ->header('Access-Control-Allow-Credentials', 'true')
    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
    ->allowCrossDomain();;//登录接口
Route::group('user', function () {
    Route::get('/sale', 'web/sale/index');//获取活动详情
    Route::get('/cards', 'web/cards/index');//获取用户卡卷列表
    Route::get('/cards_show', 'web/cards/details');//获取用户卡卷详情
    Route::post('/cards', 'web/cards/create');//领取卡卷
    Route::post('/test', 'web/cards/test');//领取卡卷
    Route::post('/merch_binding', 'web/verifyer/create');//绑定核销员
    Route::post('/write_card', 'web/cards/writeCard');//核销优惠券
})->middleware(['Auth'])
    ->header('Access-Control-Allow-Origin','*')
    ->header('Access-Control-Allow-Methods','GET,POST,PUT,DELETE,OPTIONS,PATCH')
    ->header('Access-Control-Allow-Credentials', 'true')
    ->header('Access-Control-Allow-Headers','Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With')
    ->allowCrossDomain();

Route::post('/test', 'web/test/index');//测试test
Route::get('/', 'web/home/index');//系统首页
return [

];
